#include <ast/ast.h>

namespace ast {

  static std::string stage_to_string(NodeStmtIf::Stage stage) {
    switch(stage) {
    case NodeStmtIf::Stage::NO_ELSE: return "no_else";
    case NodeStmtIf::Stage::ELSE: return "else";
    default: return "undefined";
    }
  }

  NodeStmtIf::NodeStmtIf(Stage _stage): stage(_stage) {}

  void NodeStmtIf::dot_string(std::string & str) {
    str = std::string("StmtIf") + R"(\n)"
      + "stage:" + stage_to_string(this->stage);
  }

  void NodeStmtIf::dot_accept(AstDot & ast_dot) {
    ast_dot.visit(*this);
  }

  void NodeStmtIf::accept(ir::Visitor & visitor) {
    visitor.visit(*this);
  }
}
